class Hello { public static void main ( String[] args ) { System.out.println("Hello World!"); } }
Above is the source program (source file) from the previous chapter. The purpose of this program is to type the characters Hello World! on the monitor.
The file must be named Hello.java
to match the name of the class.
On most computer systems,
the upper and lower case characters of the file name are important.
(So if the file is named hello.java
with a small h
it will not work).
On all computers,
upper and lower case inside a Java program are important.
A programming language where upper and lower case make a difference is called case sensitive. Java is case sensitive. Not all programming languages are.
The first line
class Hello
says that this source program defines a class called Hello
.
A class is a section of a program.
(A better definition will come later on in these notes.)
Small programs often consist of just one class.
When the program is compiled, the compiler will make a file of bytecodes
called Hello.class
.
Here is the first line of another Java program:
class AddUpNumbers